package com.jmc.notebookj.ui;

import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import cn.bmob.push.BmobPush;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobInstallation;

import com.jmc.notebookj.BaseActivity;
import com.jmc.notebookj.R;

/**
 * @author 作者 E-mail: EngineerJ 982007747@qq.com
 * @version 创建时间：2017-7-4 下午4:46:22 类说明
 */
public class SplashActivity extends BaseActivity {

	private static final long DELAY_TIME = 2000L;
	public static String APPID = "934cbec2ae5b55484909f03955a36873";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		// Bmob SDK初始化--只需要这一段代码即可完成初始化
		// 请到Bmob官网(http://www.bmob.cn/)申请ApplicationId,具体地址:http://docs.bmob.cn/android/faststart/index.html?menukey=fast_start&key=start_android
		Bmob.initialize(this, APPID, "Bmob");
		// 使用推送服务时的初始化操作
		BmobInstallation.getCurrentInstallation().save();
		// 启动推送服务
		BmobPush.startWork(this);
		redirectByTime();
	}

	/**
	 * 根据时间进行页面跳转
	 */
	private void redirectByTime() {
		new Handler().postDelayed(new Runnable() {

			@Override
			public void run() {
				// TODO Auto-generated method stub
				redictToActivity(SplashActivity.this,
						SingupAndLoginActivity.class, null);
				overridePendingTransition(android.R.anim.fade_in,
						android.R.anim.fade_out);
				finish();
			}
		}, DELAY_TIME);
	}

}
